<h1>Administracija Proizvoda</h1>
<?= $this->Html->link("+ Kreiraj proizvod", "/admin_products/create") ?> |
<?= $this->Html->link("Kategorije", "/admin_products/categories") ?>

<?= $this->Form->create('Filter', array('url'=>'/admin_products', 'class'=>'filter-form')) ?>
	<?= $this->Form->label('category_id', 'Kategorija:', array('class'=>'inline'))?>
	<?= $this->Form->select('category_id', $allcategories, array('value'=>@$filter['category_id'], 'empty'=>'--Sve--')) ?>
	
	<?= $this->Form->label('kword', 'Ključna reč:', array('class'=>'inline', 'style'=>'margin-left:20px'))?>
	<?= $this->Form->text('kword', array('value'=>@$filter['kword'])) ?>
	
	<?= $this->Form->submit('Filter', array('div'=>false)) ?>
	<?= $this->Form->submit('Reset', array('type'=>'button', 'div'=>false, 'onclick'=>"location.href='/admin_products'")) ?>
<?= $this->Form->end() ?>
<table>
	<tr>
		<th>Naziv</th>
		<th></th>
	</tr>
	<? if(!empty($products)): ?>
		<? foreach($products as $product): ?>
		<tr>
			<td><?= $this->Html->link($product['Product']['name'], '/admin_products/edit/' . $product['Product']['id']) ?></td>
			<td>
				<?= $this->Html->link('obriši', '/admin_products/delete/' . $product['Product']['id'], array("onclick"=>"return confirm('Da li želite da obrišete proizvod?')", 'class'=>'action delete')) ?>
			</td>
		</tr>
		<? endforeach; ?>
	<? else: ?>
	<tr><td colspan="2">Nema proizvoda.</td></tr>
	<? endif; ?>
</table>
<?= $this->element('pagination') ?>